<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 导入依赖 -->
    <script src='https://unpkg.com/@antv/l7'></script>
    <script src="https://lib.baomitu.com/jquery/2.2.4/jquery.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0
        }

        #map {
            position: absolute;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            background-color: rgba(255, 0, 0, 0.565);
        }
    </style>
</head>

<body>
    <div id="map">

    </div>
    <script>
        /* Scene场景 -L7不提供地图,只专注于地理数据可视化
        Scene 
        1、Map
        2、Layer
         */
        const scene = new L7.Scene({
            /* 设置场景的挂载点 */
            id: "map",
            map: new L7.GaodeMap({
                style: "dark",
                center: [114.30, 30.50],
                // pitch: 60,
                /* zoom可以实现放大和缩小级别 */
                zoom: 8
            }),
            logoVisible: false
        })
        scene.on('loaded', () => {
            const logo = new L7.Logo({
                // 图片 url
                img: 'https://img.gejiba.com/images/dfdb6db1623eb881e724f58d9a366af8.png',
                // 跳转地址
                href: 'http://www.x-zd.com/m',
            });
            scene.addControl(logo);

            const zoom = new L7.Zoom({
                zoomInTitle: '放大',
                zoomOutTitle: '缩小',
            });
            scene.addControl(zoom);
            const scale = new L7.Scale({
                zoomInTitle: '放大',
                zoomOutTitle: '缩小',
            });
            scene.addControl(scale);
            const fullscreen = new L7.Fullscreen({
                btnText: '全屏',
                exitBtnText: '退出全屏',
            });
            scene.addControl(fullscreen)
            const mouseLocation = new L7.MouseLocation({
                transform: (position) => {
                    return position;
                },
            });
            scene.addControl(mouseLocation);

            const mapTheme = new L7.MapTheme({});
            scene.addControl(mapTheme);


            const layer = new L7.PointLayer({
                name: '点图层',
            });
            layer.source({
                type: "FeatureCollection",
                features: [
                    {
                        type: "Feature",
                        geometry: {
                            type: "Point",
                            coordinates: [114.30, 30.50]
                        }
                    }
                ]
            })
                .shape("circle")
                .color("#333")
                .style({
                    opacity: 0.5,
                    strokeWidth: 1
                })
                .size(20)
                .active(true)
            scene.addLayer(layer);

            const layerSwitch = new L7.LayerSwitch({
                layers: [layer],
            });
            scene.addControl(layerSwitch);
        });
    </script>
</body>

</html>